package main

import (
	"fmt"
	"time"
)

var (
	a, b, c int
)

func main() {

	// 方法一
	st := int(time.Now().UnixNano())
	for a := 0; a <= 1000; a++ {
		for b := 0; b <= 1000; b++ {
			for c := 0; c <= 1000; c++ {
				if a+b+c == 1000 && a*a+b*b == c*c {
					fmt.Println("方法一:", a, b, c)

				}
			}
		}
	}
	fmt.Println("耗时:", int(time.Now().UnixNano())-st)

	st = int(time.Now().UnixNano())
	for a := 0; a <= 1000; a++ {
		for b := 0; b <= 1000; b++ {
			c = 1000 - a - b
			if a*a+b*b == c*c {
				fmt.Println("方法二:", a, b, c)

			}
		}
	}
	fmt.Println("耗时:", int(time.Now().UnixNano())-st)

}
